package com.lianxueda.drawing.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lianxueda.drawing.domain.pojo.Courses;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author 29264
* @description 针对表【courses】的数据库操作Mapper
* @createDate 2024-08-16 14:33:13
* @Entity com.lianxueda.drawing.domain.pojo.Courses
*/
@Mapper
public interface CoursesMapper extends BaseMapper<Courses> {

    @Select("SELECT * FROM courses WHERE id = (SELECT course_id FROM students WHERE id = #{id})")
    Courses selectByStudentId(Integer id);

    List<Courses> selectCourseByIds(@Param("courseIds") List<Integer> courseIds);


    Integer selectCourseIdByName(String name);

    List<Courses> selectByClassId(Integer classId);

    List<Courses> selectCoursesByIds(@Param("coursesIdList")    List<Integer> coursesIdList);

    @Select("SELECT name FROM courses WHERE id = #{courseId}")
    String selectCourseNameByCourseId(Integer courseId);
}




